+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- id="Foreground"
- x="0px"
- y="0px"
- width="16px"
- height="16px"
- viewBox="0 0 16 16"
- enable-background="new 0 0 16 16"
- xml:space="preserve"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docname="info_16.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
- id="metadata2389"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
- id="defs2387"><linearGradient
- id="linearGradient3710"><stop
- style="stop-color:#c4c4c4;stop-opacity:1;"
- offset="0"
- id="stop3712" /><stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="1"
- id="stop3714" /></linearGradient><inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 8 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="16 : 8 : 1"
- inkscape:persp3d-origin="8 : 5.3333333 : 1"
- id="perspective2391" /><linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3710"
- id="linearGradient3716"
- x1="7.9066148"
- y1="15.937743"
- x2="7.9377432"
- y2="0.031128405"
- gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
- inkscape:window-height="713"
- inkscape:window-width="722"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- guidetolerance="10.0"
- gridtolerance="10.0"
- objecttolerance="10.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- showgrid="false"
- inkscape:zoom="32.125"
- inkscape:cx="8"
- inkscape:cy="8.154146"
- inkscape:window-x="20"
- inkscape:window-y="20"
- inkscape:current-layer="Foreground" />
-<path
- fill-rule="evenodd"
- clip-rule="evenodd"
- d="M7,3h2v2H7V3z M5.5,12H7V8H5.5V7H9v5h1.5v1h-5V12z M0,8c0-4.418,3.582-8,8-8 s8,3.582,8,8s-3.582,8-8,8S0,12.418,0,8z"
- id="path2384"
- style="fill-opacity:1;fill:url(#linearGradient3716)" />
-</svg>
\ No newline at end of file
const Shell = imports.gi.Shell;
const St = imports.gi.St;
-const Button = imports.ui.button;
const DND = imports.ui.dnd;
const Link = imports.ui.link;
const Main = imports.ui.main;
const PREVIEW_PLACING = 3/4;
const PREVIEW_DETAILS_MIN_WIDTH = PREVIEW_ICON_SIZE * 2;
-const INFORMATION_BUTTON_SIZE = 16;
-
/* This is a virtual class that represents a single display item containing
* a name, a description, and an icon. It allows selecting an item and represents
* it by highlighting it with a different background color than the default.
}));
let draggable = DND.makeDraggable(this.actor);
- draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin));
this._iconBin = new St.Bin();
this.actor.add(this._iconBin);
- this._infoText = new St.BoxLayout({ style_class: "generic-display-item-text",
+ this._infoText = new St.BoxLayout({ style_class: 'generic-display-item-text',
vertical: true });
this.actor.add(this._infoText, { expand: true, y_fill: false });
- let infoIconUri = "file://" + global.imagedir + "info.svg";
- let infoIcon = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
- infoIconUri,
- INFORMATION_BUTTON_SIZE,
- INFORMATION_BUTTON_SIZE);
- this._informationButton = new Button.IconButton(this.actor, INFORMATION_BUTTON_SIZE, infoIcon);
- let buttonBox = new Big.Box({ width: INFORMATION_BUTTON_SIZE + 2 * DEFAULT_PADDING,
- height: INFORMATION_BUTTON_SIZE,
- padding_left: DEFAULT_PADDING, padding_right: DEFAULT_PADDING,
- y_align: Big.BoxAlignment.CENTER });
- buttonBox.append(this._informationButton.actor, Big.BoxPackFlags.NONE);
- this.actor.add(buttonBox, { x_fill: false, x_align: St.Align.END });
-
- // Connecting to the button-press-event for the information button ensures that the actor,
- // which is a draggable actor, does not get the button-press-event and doesn't initiate
- // the dragging, which then prevents us from getting the button-release-event for the button.
- this._informationButton.actor.connect('button-press-event',
- Lang.bind(this,
- function() {
- return true;
- }));
- this._informationButton.actor.connect('button-release-event',
- Lang.bind(this,
- function() {
- // Selects the item by highlighting it and displaying its details
- this.emit('show-details');
- return true;
- }));
-
this._name = null;
this._description = null;
this._icon = null;
//// Public methods ////
- // Shows the information button when the item was drawn under the mouse pointer.
- onDrawnUnderPointer: function() {
- this._informationButton.show();
- },
-
// Highlights the item by setting a different background color than the default
// if isSelected is true, removes the highlighting otherwise.
markSelected: function(isSelected) {
this.actor.set_style_pseudo_class(isSelected ? "selected" : null);
- this._informationButton.forceShow(isSelected)
},
/*
// Returns a preview icon for the item.
_createPreviewIcon: function() {
throw new Error("Not implemented");
- },
+ }
//// Private methods ////
-
- // Hides the information button once the item starts being dragged.
- _onDragBegin : function (draggable, time) {
- // For some reason, we are not getting leave-event signal when we are dragging an item,
- // so we should remove the link manually.
- this._informationButton.actor.hide();
- }
};
Signals.addSignalMethods(GenericDisplayItem.prototype);
this.selectFirstItem();
}
- Mainloop.idle_add(Lang.bind(this, this._checkInformationIcon),
- Meta.PRIORITY_BEFORE_REDRAW);
-
this.emit('redisplayed');
},
- // Check if the pointer is over one of the items and display the information button if it is.
- // We want to do this between finishing our changes to the display and the point where
- // the display is redrawn.
- _checkInformationIcon: function() {
- let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
- let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE,
- x, y);
- if (actor != null) {
- let item = this._findDisplayedByActor(actor);
- if (item != null) {
- item.onDrawnUnderPointer();
- }
- }
- return false;
- },
-
//// Pure virtual protected methods ////
// Performs the steps needed to have the latest information about the items.